package com.jz.netthings.application.providerCollection.controller;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.jz.netthings.application.providerCollection.bean.ParameterSettings;
import com.jz.netthings.application.providerCollection.bean.Periodic;
import com.jz.netthings.application.providerCollection.bean.Poweroff;
import com.jz.netthings.application.providerCollection.service.PeriodicService;
import com.jz.netthings.application.providerCollection.service.PoweroffService;
import com.jz.netthings.exception.AdscmSystemException;
import com.jz.netthings.support.SimpleCoreResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;

/**
 * <p>
 * 采浆记录-机器关闭 前端控制器
 * </p>
 *
 * @author zyl
 * @since 2019-03-25
 */
@RestController
@RequestMapping("/adscm/application/providerCollection/select/poweroff")
public class PoweroffController {
    @Autowired
    PoweroffService poweroffService;
    @RequestMapping("/selectPoweroff")
    public SimpleCoreResponse selectPoweroff( String mlogId , HttpServletRequest request) throws AdscmSystemException, IOException {
        Wrapper<Poweroff> wrapper =new EntityWrapper<>();
        wrapper.like("mlogId", mlogId);
        List<Poweroff> poweroffs = poweroffService.selectList(wrapper);
        Poweroff poweroff =new Poweroff();
        if (poweroffs!=null && poweroffs.size()>0){
            poweroff=poweroffs.get(0);
        }
        return new SimpleCoreResponse("200","查询成功" ,poweroff);
    }
}

